﻿using System;
using System.Collections;
using Character;
using UnityEngine;
using UnityEngine.UI;

// Token: 0x020002C8 RID: 712
public class TitleScene : Scene
{
	// Token: 0x0600125E RID: 4702 RVA: 0x00079164 File Offset: 0x00077364
	private void Start()
	{
		GlobalData.isMemory = false;
		this.config = UnityEngine.Object.Instantiate<Config>(this.configOriginal);
		this.config.gameObject.SetActive(false);
		this.save_load = UnityEngine.Object.Instantiate<SaveLoadMode>(this.save_loadOriginal);
		this.save_load.gameObject.SetActive(false);
		base.InScene(false);
		for (int i = 0; i < this.buttons.Length; i++)
		{
			this.buttons[i].gameObject.SetActive(false);
		}
		base.GC.audioCtrl.BGM_LoadAndPlay(this.bgm, false, true);
		this.pauseMenue = UnityEngine.Object.Instantiate<PauseMenue>(this.pauseMenueOriginal);
		this.pauseMenue.Setup(true, false, new Action(this.Button_Config), null, null);
		ScreenFade.StartFade(ScreenFade.TYPE.IN, base.GC.FadeColor, this.fadeInTime, 0f, null, true);
		base.StartCoroutine(this.ShowButtons());
	}

	// Token: 0x0600125F RID: 4703 RVA: 0x00079260 File Offset: 0x00077460
	private void Update()
	{
		if (this.titleCallEnable && this.timer >= this.titleCallTime)
		{
			this.TitleCall();
		}
		this.timer += Time.deltaTime;
		bool flag = !this.config.isActiveAndEnabled && !this.save_load.isActiveAndEnabled;
		this.uiCanvas.enabled = flag;
		this.pauseMenue.EnableConfig = flag;
	}

	// Token: 0x06001260 RID: 4704 RVA: 0x000792DC File Offset: 0x000774DC
	public void Button_Start()
	{
		base.GC.audioCtrl.Play2DSE(base.GC.audioCtrl.systemSE_yes);
		GlobalData.PlayData.Start();
		string msg = EditScene.CreateMessage("律子", "GameStart");
		base.GC.CreateModalYesNoUI("ゲームを開始する前に\nキャラクターをカスタムしますか？", delegate
		{
			this.GC.ChangeScene("EditScene", msg, 1f);
		}, new Action(this.StartADVScene));
	}

	// Token: 0x06001261 RID: 4705 RVA: 0x00079360 File Offset: 0x00077560
	private void StartADVScene()
	{
		base.GC.ChangeScene("ADVScene", "adv/adv_00_00,ADV_Script_00_00", 1f);
	}

	// Token: 0x06001262 RID: 4706 RVA: 0x0007937C File Offset: 0x0007757C
	public void Button_Load()
	{
		base.GC.audioCtrl.Play2DSE(base.GC.audioCtrl.systemSE_open);
		this.save_load.Setup(SaveLoadMode.MODE.LOAD);
		this.save_load.gameObject.SetActive(true);
	}

	// Token: 0x06001263 RID: 4707 RVA: 0x000793BC File Offset: 0x000775BC
	public void Button_Continue()
	{
		base.GC.audioCtrl.Play2DSE(base.GC.audioCtrl.systemSE_yes);
		string continueSaveFile = GlobalData.GetContinueSaveFile();
		GlobalData.PlayData.Load(continueSaveFile);
		base.GC.ChangeScene("SelectScene", "Load", 1f);
	}

	// Token: 0x06001264 RID: 4708 RVA: 0x00079414 File Offset: 0x00077614
	public void Button_Config()
	{
		base.GC.audioCtrl.Play2DSE(base.GC.audioCtrl.systemSE_open);
		this.config.gameObject.SetActive(true);
	}

	// Token: 0x06001265 RID: 4709 RVA: 0x00079448 File Offset: 0x00077648
	public void Button_DemoMovie()
	{
		base.GC.audioCtrl.Play2DSE(base.GC.audioCtrl.systemSE_yes);
		base.GC.ChangeScene("DemoMovie", string.Empty, 1f);
	}

	// Token: 0x06001266 RID: 4710 RVA: 0x00079484 File Offset: 0x00077684
	public void Button_Uploader()
	{
		base.GC.audioCtrl.Play2DSE(base.GC.audioCtrl.systemSE_yes);
		base.GC.ChangeScene("UpDownLoader", string.Empty, 1f);
	}

	// Token: 0x06001267 RID: 4711 RVA: 0x000794C0 File Offset: 0x000776C0
	public void Button_Exit()
	{
		base.GC.audioCtrl.Play2DSE(base.GC.audioCtrl.systemSE_yes);
		base.GC.CreateModalYesNoUI("ゲームを終了します。\nよろしいですか？", new Action(this.ExitGame), null);
	}

	// Token: 0x06001268 RID: 4712 RVA: 0x00079500 File Offset: 0x00077700
	private void ExitGame()
	{
		base.GC.ChangeScene("ExitScene", string.Empty, 1f);
	}

	// Token: 0x06001269 RID: 4713 RVA: 0x0007951C File Offset: 0x0007771C
	private void TitleCall()
	{
		this.titleCallEnable = false;
		string[] array = new string[]
		{
			"A",
			"B"
		};
		int num = UnityEngine.Random.Range(0, 4);
		HEROINE heroineID = (HEROINE)num;
		int num2 = (!GlobalData.flipflop) ? 0 : UnityEngine.Random.Range(0, 2);
		string path = "SystemVoice/TitleCall/TitleCall_F" + num.ToString("00") + "_" + array[num2];
		this.audio.clip = Resources.Load<AudioClip>(path);
		this.audio.volume = ConfigData.VolumeVoice_Heroine(heroineID);
		this.audio.pitch = ConfigData.PitchVoice_Heroine(heroineID);
		this.audio.Play();
	}

	// Token: 0x0600126A RID: 4714 RVA: 0x000795C8 File Offset: 0x000777C8
	private IEnumerator ShowButtons()
	{
		yield return new WaitForSeconds(1.5f);
		if (GlobalData.CheckContinueSave())
		{
			this.buttons[0].gameObject.SetActive(true);
			yield return new WaitForSeconds(0.1f);
		}
		for (int i = 1; i < this.buttons.Length; i++)
		{
			this.buttons[i].gameObject.SetActive(true);
			yield return new WaitForSeconds(0.1f);
		}
		yield break;
	}

	// Token: 0x04001431 RID: 5169
	public float fadeInTime = 1f;

	// Token: 0x04001432 RID: 5170
	public float titleCallTime = 2f;

	// Token: 0x04001433 RID: 5171
	private float timer;

	// Token: 0x04001434 RID: 5172
	private bool titleCallEnable = true;

	// Token: 0x04001435 RID: 5173
	[SerializeField]
	private AudioSource audio;

	// Token: 0x04001436 RID: 5174
	[SerializeField]
	private Canvas uiCanvas;

	// Token: 0x04001437 RID: 5175
	[SerializeField]
	private Button[] buttons = new Button[5];

	// Token: 0x04001438 RID: 5176
	[SerializeField]
	private Config configOriginal;

	// Token: 0x04001439 RID: 5177
	private Config config;

	// Token: 0x0400143A RID: 5178
	[SerializeField]
	private SaveLoadMode save_loadOriginal;

	// Token: 0x0400143B RID: 5179
	private SaveLoadMode save_load;

	// Token: 0x0400143C RID: 5180
	[SerializeField]
	private PauseMenue pauseMenueOriginal;

	// Token: 0x0400143D RID: 5181
	private PauseMenue pauseMenue;

	// Token: 0x0400143E RID: 5182
	private string bgm = "Title";

	// Token: 0x020002C9 RID: 713
	private enum BUTTONS
	{
		// Token: 0x04001440 RID: 5184
		CONTINUE,
		// Token: 0x04001441 RID: 5185
		START,
		// Token: 0x04001442 RID: 5186
		LOAD,
		// Token: 0x04001443 RID: 5187
		CONFIG,
		// Token: 0x04001444 RID: 5188
		EXIT,
		// Token: 0x04001445 RID: 5189
		NUM
	}
}
